<div id="push"></div>
</div>

<footer id="footer">
    <div class="container">
        <div class="pull-left">
            <a href="/sitemap/">Sitemap</a>
            |
            <a href="/about">About</a>
            |
            <a href="/contact/">Get In Touch</a>
            |
            <a href="/blog/">Blog</a>
        </div>
        <div class="pull-right">&copy; <a href="/">PitchWise Ltd.</a> 2013 <a href="#">Terms & Conditions</a> and <a href="#">Privacy Policy</a></div>
    </div>
</footer>

<div id="loginModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="loginModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h2 id="myModalLabel" style="margin: 0;">Login</h2>
    </div>

    <form name="loginform" class="form-horizontal" id="loginform" action="/wp-login.php"
          method="post" style="margin:0">

        <?
        $items = array(
            "name" => "Name",
            "address" => "Address",
            "nearest_station" => "Nearest Station(s)",
            "changing_rooms" => "Changing Rooms",
            "showers" => "Showers"
        );
        ?>
        <? foreach ($_POST as $key => $value) { ?>
        <input type="hidden" name="<? echo $key ?>" value="<? echo $value ?>" />
        <? } ?>

        <input type="hidden" name="form_pitch" value="<? echo $_REQUEST['form_pitch'] ?>" />
        <input type="hidden" name="form_slot" value="<? echo $_REQUEST['form_slot'] ?>" />
        <input type="hidden" name="form_date" value="<? echo $_REQUEST['form_date'] ?>" />
        <input type="hidden" name="form_price" value="<? echo $_REQUEST['form_price'] ?>" />

        <div class="modal-body">


            <div class="control-group">
                <label class="control-label" for="user_login">Username / Email</label>

                <div class="controls">
                    <input type="text" name="log" id="user_login" class="input" value="" size="20" tabindex="10">
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="user_pass">Password</label>

                <div class="controls">
                    <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="10">
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="rememberme">Remember Me</label>

                <div class="controls">
                    <input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90">
                </div>
            </div>

            <p class="login-submit">
                <input type="hidden" name="redirect_to" value="">
            </p>

            <div class="alert alert-info" id="login-alert" style="display:none">
                <strong>Warning!</strong> Best check yo self, you're not looking too good.
            </div>



        </div>
        <div class="modal-footer">
            <a class="btn" data-dismiss="modal" aria-hidden="true" tabindex="2">Close</a>
            <a class="btn pull-left btn-inverse" href="/register/">Register</a>
            <button class="btn btn-primary" type="submit" name="wp-submit" id="wp-submit" value="Log In" tabindex="100">
                Login
            </button>
        </div>
    </form>
</div>

<div style="display:none">
    <div id="var-authenticated"></div>
</div>

<script src="<?php echo get_template_directory_uri(); ?>/js/jquery-1.8.2.min.js"></script>

<script src="<?php echo get_template_directory_uri(); ?>/js/bootstrap.min.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/js/underscore.js"></script>

<script src="<?php echo get_template_directory_uri(); ?>/js/PW.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/js/PW.pitch.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/js/PW.confirmBooking.js"></script>

<!--
<script src="<?php echo get_template_directory_uri(); ?>/js/PITCHWISE.login.js"></script>

<!--
<script type="text/javascript">
    $(function () {
        var options = {
            'authenticated' : <?php if (is_user_logged_in()) {echo 'true';} else {echo 'false';} ?>,
            'role':"<?php echo get_user_role() ?>",
            'logoutUrl':"<?php echo wp_logout_url( home_url() ); ?>"
        };
        var login = new PITCHWISE.login(options);
    });
</script>
-->

        <script>
            $(function () {
                $('[name=redirect_to]').val(document.URL);

            <?php if (is_user_logged_in()) {?>
                $('[href=#loginModal]')
                        .attr('href','<?php echo wp_logout_url( "/home/" ); ?>')
                        .attr('data-toggle',"")
                        .html('Logout');
                $('[href*=register]').hide();
                $('[href*=account]').show();
                $('[href*=my-venue]').hide();
                $('[href*=my-calendar]').hide();

                <? $user = wp_get_current_user(); ?>
                <? if ( in_array( 'customer', $user->roles ) ) { ?>
                <? } ?>

                <? if ( in_array( 'operator', $user->roles ) ) { ?>
                    $('[href*=my-account]').hide();
                    $('[href*=my-venue]').show();
                    $('[href*=my-calendar]').show();
                    $('[href*=account]').hide();
                    $('[href*=pitches]').hide();
                <? } ?>

            <?} else {?>
                $('[href*=account]').hide();
                $('[href*=my-venue]').hide();
                $('[href*=my-calendar]').hide();
            <?}?>

            });
        </script>

<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-40318890-1', 'pitchwise.co.uk');
    ga('send', 'pageview');

</script>

<?php wp_footer(); ?>

</body>
</html>